<?php
/**
 * Copyright (C) 2010-2013 Oscar Valenzuela B. (ovalenzuela@xpertians.com)
 * 
 * This file is part of WarpIT.
 * WarpIT is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * WarpIT is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with WarpIT.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * ConsultashssModel class
 * @author Oscar Valenzuela <ovalenzuela@xpertians.com>
 * @version 1.0
 * @package WarpIT!
 * @copyright Copyright (C) 2010-2013 Xpertians SpA
 * @license GNU GPLv3 or later
 * @link http://www.xpertians.com
 */

class ConsultashssModel{
	/**
	  * System instance
	 *
	  * @var mixed
	 */
	private $mainObj;

	/**
	  * Url parameters
	 *
	  * @var string
	 */
	private $params;

	/**
	  * ConsultashssController is the constructor of this class 
	 *
	  * Following syntax are recognized :
	 *
	  * @param mixed $mainObj System instance
	  * @param string $params URL Params
	 */
	public function ConsultashssModel($mainObj,$params){
		$this->mainObj	= $mainObj;
		$this->params	= $params;	
	}
	
	/**
	  * getConsultashss obtain all records from repository 
	 *
	  * Following syntax are recognized :
	 *
	  * @param mixed $mainObj System instance
	  * @param string $params URL Params
	  * @return array
	 */
	public function getConsultashss($mainObj,$params){
		$this->mainObj		= $mainObj;
		$this->params		= $params;	
		$table			= "Consultas_HSS";
		$fields			= "";
		$conditions		= "";
		$limit			= "";
		$ConsultashssArr		= $this->mainObj->GetDataFromDB($table,$fields,$conditions,$limit);
		return $ConsultashssArr;
	}

	/**
	  * getConsultahss obtain data from single record from repository 
	 *
	  * Following syntax are recognized :
	 *
	  * @param mixed $mainObj System instance
	  * @param string $params URL Params
	  * @param integer $ConsultahssId Record Database Id
	  * @return array
	 */
	public function getConsultahss($mainObj,$params,$ConsultahssId){
		$this->mainObj		= $mainObj;
		$this->params		= $params;	
		$table			= "Consultas_HSS";
		$fields			= "";
		$conditions		= array();
		$conditions['Id']	= $ConsultahssId;
		$limit			= "";
		$ConsultashssArr		= $this->mainObj->GetDataFromDB($table,$fields,$conditions,$limit);
		return $ConsultashssArr;
	}
	
	/**
	  * updateConsultahss update data from single record from repository 
	 *
	  * Following syntax are recognized :
	 *
	  * @param mixed $mainObj System instance
	  * @param array $fields Columns name to update on array sentence
	  * @param array $conditions Columns name and data to conditional use
	  * @return mixed
	 */
	public function updateConsultahss($mainObj,$fields,$conditions){
		$this->mainObj		= $mainObj;
		$this->params		= $params;	
		$table			= "Consultas_HSS";
		$exeQry			= $this->mainObj->UpdateDataToDB($table,$fields,$conditions);
		if($this->mainObj->ConfirmExecutionFromDB($exeQry)){
			return $this->mainObj->info('Updated');
		}else{
			return $this->mainObj->info('Error_Updated');
		}
	}
	

	/**
	  * insertConsultahss insert a single record into repository 
	 *
	  * Following syntax are recognized :
	 *
	  * @param mixed $mainObj System instance
	  * @param array $fields Columns name to insert on array sentence
	  * @return mixed
	 */
	public function insertConsultahss($mainObj,$fields){
		$this->mainObj		= $mainObj;
		$this->params		= $params;	
		$table			= "Consultas_HSS";
		$this->mainObj->InsertDataToDB($table,$fields);
		if($this->mainObj->getInsertIdFromDB()){
			return $this->mainObj->info('Inserted');
		}else{
			return $this->mainObj->info('Error_Inserted');
		}
	}
	
	/**
	  * deleteConsultahss delete a single record from repository 
	 *
	  * Following syntax are recognized :
	 *
	  * @param mixed $mainObj System instance
	  * @param array $conditions Columns name and data to conditional use
	  * @return mixed
	 */
	public function deleteConsultahss($mainObj,$conditions){
		$this->mainObj		= $mainObj;
		$this->params		= $params;	
		$table			= "Consultas_HSS";
		$exeQry			= $this->mainObj->DeleteDataToDB($table,$conditions);
		if($this->mainObj->ConfirmExecutionFromDB($exeQry)){
			return $this->mainObj->info('Deleted');
		}else{
			return $this->mainObj->info('Error_Deleted');
		}
	}				
}
?>
